package com.amos.muexamclient.sys.service.impl;

import com.amos.muexamclient.sys.entity.SysRoleMenuEntity;
import com.amos.muexamclient.sys.mapper.SysRoleMenuMapper;
import com.amos.muexamclient.sys.service.SysRoleMenuService;
import com.amos.muexamclient.sys.service.dto.SysRoleMenuDTO;
import com.amos.muexamcore.core.AbstractPageService;
import com.amos.muexamcore.core.BaseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Copyright © 2018 五月工作室. All rights reserved.
 *
 * @Package com.amos.muexamclient.sys.service.impl
 * @ClassName SysRoleMenuServiceImpl
 * @Description TODO
 * @Author Amos
 * @Modifier
 * @Date 2020-03-24 14:36:11
 * @Version 1.0
 **/
@Service
public class SysRoleMenuServiceImpl extends AbstractPageService<SysRoleMenuDTO, SysRoleMenuEntity> implements SysRoleMenuService {

    @Autowired
    private SysRoleMenuMapper sysRoleMenuMapper;

    /**
     * 条件查询
     *
     * @param dto 查询的条件
     */
    @Override
    public List<SysRoleMenuDTO> list(SysRoleMenuDTO dto) {
        return this.getMapper().select(dto);
    }

    /**
     * 返回BaseDao对象
     */
    @Override
    public BaseMapper<SysRoleMenuEntity, SysRoleMenuDTO> getMapper() {
        return sysRoleMenuMapper;
    }

    /**
     * 保存之间的校验
     *
     * @param dto 保存的对象
     */
    @Override
    public void preValidate(SysRoleMenuDTO dto) {

    }

    /**
     * 添加子集数据
     *
     * @param id  主表ID
     * @param dto 主表DTO对象
     */
    @Override
    public void appendSubsidiary(String id, SysRoleMenuDTO dto) {

    }

    @Override
    public int checkMenuExistRole(String menuId) {
        return this.sysRoleMenuMapper.checkMenuExistRole(menuId);
    }
}
